﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
public partial class Brush : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int width = 400, hight = 250;
        Bitmap bitmap = new Bitmap(width, hight);
        Graphics g = Graphics.FromImage(bitmap);
        try
        {
            g.Clear(Color.YellowGreen);
            Pen p1 = new Pen(Color.Black);
            g.DrawRectangle(p1, 30, 30, 70, 50);
            SolidBrush brush1 = new SolidBrush(Color.Black);
            g.FillRectangle(brush1, 130, 30, 70, 50);

            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
            Response.ClearContent();
            Response.ContentType = ("image/Gif");
            Response.BinaryWrite(ms.ToArray());
        }
        catch (Exception ms)
            {
                Response.Write(ms.Message);
            }
    }
}